package com.wzg.appframe.action;

import android.content.Context;

import com.wzg.appframe.utils.GsonUtil;
import com.wzg.appframe.utils.TLog;
import com.wzg.appframe.web.jsbridge.JavaSctiptMethods;
import com.wzg.appframe.webservice.WebServiceBaseTask;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.Date;
import java.util.Map;

public class WebAction extends BaseAction {
    JavaSctiptMethods mJavaSctiptMethods;
    String reqServerCallBack;

    public WebAction(Context context) {
        super(context);
    }

    public WebAction(Context context, JavaSctiptMethods javaSctiptMethods) {
        super(context);
        this.mJavaSctiptMethods = javaSctiptMethods;
    }

    public void reqKDServer(String json) throws JSONException {
        JSONObject jsonObject = new JSONObject(json);
        reqServerCallBack = jsonObject.optString("callback");
        String methodName = jsonObject.optString("methodName");
        String parmas = jsonObject.optString("parmas");

//        WebServiceBaseTask serviceTask = new WebServiceBaseTask(this, KDReqUrl, methodName, map);
//        serviceTask.isH5Req = true;
//        serviceTask.execute();

    }


    @Override
    public void postCallBack(String methodName, Object result) {

        mJavaSctiptMethods.invokeJavaScript(reqServerCallBack, methodName, result.toString());
    }
}
